using System;
using System.Collections.Generic;
using System.Text;
using DataBase.Core;
using System.Data;

namespace MeetFuture.MRC
{
	public partial class clsToolList
	{
        private const string key_Name = "TOOLLIST=";
        private const string key_split = ",";

        private Dictionary<string, clsToolInfo> _ToolList = new Dictionary<string, clsToolInfo>();

        public clsToolList()
        {
            this._ToolList = new Dictionary<string, clsToolInfo>();
        }
        public Dictionary<string, clsToolInfo> ToolList
        {
            get { return this._ToolList; }
        }
        public void Add(clsToolInfo tool)
        {
            try
            {
                clsToolInfo tmpTool = null;
                this._ToolList.TryGetValue(tool.ToolID, out tmpTool);
                if (tmpTool == null)
                {
                    this._ToolList.Add(tool.ToolID, tool);
                } 
                else
                {
                    this._ToolList[tool.ToolID] = tool;
                }
            }
            catch (System.Exception ex)
            {	
            }            
        }
        public void Remove(clsToolInfo tool)
        {
            try
            {
                this._ToolList.Remove(tool.ToolID);
            }
            catch (System.Exception ex)
            {	
            }            
        }
        public void Remove(string ToolId)
        {
            try
            {
                this._ToolList.Remove(ToolId);
            }
            catch (System.Exception ex)
            {	
            }            
        }
        public clsToolInfo FindTool(string ToolId)
        {
            clsToolInfo result = null;
            try
            {
                this._ToolList.TryGetValue(ToolId, out result);
            }
            catch (System.Exception ex)
            {	
            }
            return result;
        }        
        public string ToObjectString()
        {
            string result = string.Empty;
            try
            {
                result += key_Name + "[";
                foreach (clsToolInfo tool in this._ToolList.Values)
                {
                    result += tool.ToObjectString();
                }
                result += "]";
            }
            catch (System.Exception ex)
            {
            }
            return result;
        }
	}
}
